package com.ctyun.xstore.sts.client;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.securitytoken.AWSSecurityTokenService;
import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder;

public class AmazonSTSClientBuilder {
    public static final String END_POINT = "";
    public static final String BUCKET = "";
    private static final String ACCESS_KEY = "";
    private static final String SECRET_KEY = "";
    public static final String ARN = "";

    public static AWSSecurityTokenService buildSTSClient() {
        BasicAWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration(END_POINT, Regions.DEFAULT_REGION.getName());
        AWSSecurityTokenService stsClient = AWSSecurityTokenServiceClientBuilder.standard()
                .withCredentials(new AWSStaticCredentialsProvider(credentials))
                .withEndpointConfiguration(endpointConfiguration)
                .build();
        return stsClient;
    }

}
